package com.example.ams.repository;

import com.example.ams.entity.AttendanceSummary;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * 考勤统计数据访问层
 * Attendance Summary Repository
 */
@Repository
public interface AttendanceSummaryRepository extends JpaRepository<AttendanceSummary, Long> {

    /**
     * 根据员工ID和月份查询统计
     */
    Optional<AttendanceSummary> findByEmployeeIdAndMonth(Long employeeId, String month);

    /**
     * 根据月份查询所有统计
     */
    List<AttendanceSummary> findByMonth(String month);

    /**
     * 根据员工ID查询所有统计
     */
    List<AttendanceSummary> findByEmployeeIdOrderByMonthDesc(Long employeeId);
}

